import Taro, {Component} from '@tarojs/taro'
import 'taro-ui/dist/style/index.scss'
import Index from './pages/orderDetail/index'
import {Provider} from '@tarojs/redux'
import '@tarojs/async-await'
import dva from './dva'
import models from './model'
import './app.less'

// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }
const dvaApp = dva.createApp({
  initialState: {},
  models: models,
  onError(e, dispatch) {
    dispatch({
      type: "sys/error",
      payload: e
    });
  },
});
const store = dvaApp.getStore();

class App extends Component {

  config = {
    pages: [
      'pages/home/index', // 首页
      'pages/searchMatch/index', // 帮我选址
      'pages/houseDetail/index',
      'pages/login/index',
      'pages/businessHome/index', // 首页
      'pages/businessList/index', //订单设备产品 列表
      'pages/businessDetail/index', // 订单设备产品 详情
      'pages/companyRelease/index', // 发布企业
      'pages/companyProductList/index', // 产品图片查看更多
      'pages/companyList/index', // 公司搜索
      'pages/companyDetail/index', // 公司详情
      'pages/personalCenter/index', // 我的
      'pages/rentRelease/index', // 发布求租
      'pages/productRelease/index', //发布产品
      'pages/deviceRelease/index', //发布设备
      'pages/message/index',
      'pages/houseHome/index', // 厂房出租
      'pages/environmentAssessment/index', //环评办理
      'pages/recruitmentList/index', //求职招聘列表
      'pages/recruitmentDetails/index', //求职招聘详情
      'pages/recruitmentRelease/index', //发布求职招聘
      'pages/businessReleaseHome/index', // 发布个人信息
      'pages/orderRelease/index',
      'pages/enterpriseHandling/index',
      'pages/rentList/index'  //厂房租赁列表
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: '江苏厂管家',
      navigationBarTextStyle: 'black'
    },
    tabBar: {
      color: "#949494",
      selectedColor: "#ff505f",
      list: [
        {
          "pagePath": "pages/home/index",
          "text": "首页",
          "iconPath": './images/tab/home.png',
          "selectedIconPath": './images/tab/home_active.png'
        },
        {
          "pagePath": "pages/companyList/index",
          "text": "企业圈",
          "iconPath": './images/tab/business.png',
          "selectedIconPath": './images/tab/business_active.png'
        },
        {
          "pagePath": "pages/businessReleaseHome/index",
          "text": "发布",
          "iconPath": './images/tab/open.png',
          "selectedIconPath": './images/tab/open_active.png'
        },
        {
          "pagePath": 'pages/message/index',
          "text": "消息",
          "iconPath": './images/tab/message.png',
          "selectedIconPath": './images/tab/message_active.png'
        },
        {
          "pagePath": "pages/personalCenter/index",
          "text": "我的",
          "iconPath": './images/tab/mine.png',
          "selectedIconPath": './images/tab/mine_active.png'
        }
      ]
    }
  }


  componentDidMount() {
  }

  componentDidShow() {
  }

  componentDidHide() {
  }

  componentDidCatchError() {
  }

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render() {
    return (
      <Provider store={store}>
        <Index/>
      </Provider>
    )
  }
}

Taro.render(<App/>, document.getElementById('app'))
